package org.edu.modules.research.rproject.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.edu.common.base.BasePageDto;
import org.edu.common.base.BaseServiceImpl;
import org.edu.common.utils.ConvertUtils;
import org.edu.common.base.BaseServiceImpl;
import org.edu.modules.research.rproject.mapper.VeJkyProjectGainUserMapper;
import org.edu.modules.research.rproject.entity.VeJkyProjectGainUser;
import org.edu.modules.research.rproject.dto.VeJkyProjectGainUserDto;
import org.edu.modules.research.rproject.service.VeJkyProjectGainUserService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;


/**
 * 实现类
 */
@Service
public class VeJkyProjectGainUserServiceImpl extends BaseServiceImpl<VeJkyProjectGainUser, VeJkyProjectGainUserMapper> implements VeJkyProjectGainUserService {

    @Override
    public void deleteByPId(Integer pId) {
        mapper.deleteBypId(pId);
    }

    public IPage<VeJkyProjectGainUserDto> pageDto(BasePageDto page, @Param(Constants.WRAPPER) Wrapper queryWrapper){
        return mapper.pageDto(page,queryWrapper);
    }
    /**
    * 查询实体类
    */
    public VeJkyProjectGainUserDto findDtoById(String id) {
        VeJkyProjectGainUser entity = super.findById(id);
        VeJkyProjectGainUserDto dto = ConvertUtils.convertToDto(entity, VeJkyProjectGainUserDto.class);
        return dto;
    }

    /**
    * 新增或者修改
    */
    public void insertOrUpdate(VeJkyProjectGainUserDto dto,Boolean isAdd){
        if(isAdd){
            super.insert(dto);
        }else{
            super.update(dto);
        }
    }

}
